<template>
  <div class="flow-record-main">
    <el-timeline>
      <el-timeline-item v-for="(item, index) in data" :key="index" :type="'primary'" :size="'large'">
        <template #dot>
          <div class="timeline-circle" :style="{ background: getColor(item.type) }">
            {{ item.nodeType === "START" ? "发" : tag }}
          </div>
        </template>
        <div class="record-card">
          <div class="record-card-title">
            <span class="span1">{{ item.nodeName }}：</span>
            <span class="span2">{{ item.name }} </span>
            <span class="span1"> / {{ item.dept || "--" }}</span>
            <span class="span1 span3">提交时间： {{ item.time || "--" }}</span>
          </div>
          <div class="record-card-content" :style="{ color: getColor(item.type) }" v-html="item.opinion || '--'"></div>
        </div>
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script setup lang="ts">
defineProps({
  data: {
    type: Array as any,
    default: () => []
  },
  tag: {
    type: String,
    default: "审"
  }
});
const getColor = type => {
  return type === "START" ? "rgba(0, 165, 189, 1)" : "rgba(42, 130, 228, 1)";
};
</script>

<style lang="scss" scoped>
.flow-record-main {
  min-height: 300px;
  padding: 16px;
  .timeline-circle {
    width: 24px;
    height: 24px;
    font-size: 12px;
    line-height: 24px;
    color: white;
    text-align: center;
    border-radius: 24px;
  }
  .record-card {
    padding: 0 16px;
    background: var(--el-bg-color3);
    border-radius: 2px;
    .record-card-title {
      padding: 12px 0;
      border-bottom: 1px solid var(--el-border-color);
      .span1 {
        color: var(--el-header-menu-text-color);
      }
      .span2 {
        color: var(--el-header-logo-text-color);
      }
      .span3 {
        float: right;

        // width: 200px;
      }
    }
    .record-card-content {
      padding: 12px 0;
      white-space: pre-wrap;
    }
  }
  .el-timeline {
    padding-inline-start: 0;
  }
  :deep().el-timeline-item__tail {
    left: 10px;
  }
  :deep().el-timeline-item__wrapper {
    top: 0;
    padding-left: 48px;
  }
}
</style>
